import requests, sys, webbrowser, bs4

print("bing....")
# https://cn.bing.com/search?q=togaf
# res = requests.get('https://cn.bing.com/search?q=' + ' '.join(sys.argv[1:]))
res = requests.get('https://cn.bing.com/search?q=togaf')
res.raise_for_status()
soup = bs4.BeautifulSoup(res.text, features="html.parser")
linkElems = soup.select('h2 a')
numOpen = min(5, len(linkElems))
print(len(linkElems))
for el in linkElems:
    url = el.get('href')
    print(url)
    webbrowser.open(url)
